﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace skvote
{
    public partial class admin_admin : System.Web.UI.Page
    {
        private OleDbConnection connection = new conn().CreateConnection();
        public config cfg = new config();
        protected void Page_Load(object sender, EventArgs e)
        {
            function.check();
        }

        protected void submit_Click(object sender, EventArgs e)
        {
            try
            {
                string username = function.nohtml(Request["username"].ToString());
                string password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(function.nohtml(Request["password"].ToString()), "md5");
                OleDbCommand cmd = new OleDbCommand("UPDATE XH_Config SET username=\"" + username + "\",[password]=\"" + password + "\"", connection);
                cmd.ExecuteNonQuery();
                function.successMsg("修改管理员信息成功");
            }
            catch (InvalidOperationException)
            {
            }
            finally
            {
                connection.Close();
            }
            
        }
    }
}
